package net.hn.hnms.sys.common.core.enums;

import cn.hutool.core.util.StrUtil;

import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;

public enum CoalInfo {


    WEIJIAMAO("42d74535d02244f1ab8f2f482b0e0b2a", "1", "150622004330", "91150100767874571R", "魏家峁露天矿", "北能公司","北方公司","1"),
    GAOTOUYAO("273a60f6e1f645c2a5abbde192a89e25", "2", "150621011038", "91150100767874571R", "高头窑煤矿", "北能公司","北方公司","1"),
    HUAJIAN("1a16d7db7f9843c9a1c5eb3b5c61465b", "1", "150622004317", "91150100767874571R", "铧尖露天矿", "北能公司","北方公司","1"),
    XICHUAN("ce00b899fa184398a3c2a1f6a4dcc334", "2", "610204017042", "91610132311043067B", "西川煤矿", "陕西矿业分公司","陕西矿业","0"),
    QINGPINGANG("3e6309cb08cc4f5392ef9969ad18f12c", "2", "610429017222", "91610132311043067B", "青岗坪煤矿", "陕西矿业分公司","陕西矿业","0"),
    LIUXIANG("3c413b806ee54a62ada32b2089f0f889", "2", "610802003155", "91610132311043067B", "柳巷煤矿", "陕西矿业分公司","陕西矿业","0"),//0煤业1北方2蒙东
    HUATING("c7eef52bac7f4215b3b9f51f13e5754d", "2", "620824009663", "916200002258722645", "华亭煤矿", "华亭煤业公司","华亭煤业","0"),
    YANBEI("181ae9d6e70a4932aaa910fd9f68ff97", "2", "620824009734", "916200002258722645", "砚北煤矿", "华亭煤业公司","华亭煤业","0"),
    CHENJIAGOU("3ffe1176666f44df88470bc83ac7e77d", "2", "620824009382", "916200002258722645", "陈家沟煤矿", "华亭煤业公司","华亭煤业","0"),
    DONGXIA("9d93d6decf814526aa1984f9218db1c2", "2", "620824009235", "916200002258722645", "东峡煤矿", "华亭煤业公司","华亭煤业","0"),
    MATIGOU("cd66116554294391aa295713c3f63ac4", "2", "620824009852", "916200002258722645", "马蹄沟煤矿", "华亭煤业公司","华亭煤业","0"),
    SHANZHAI("c294c470cb9c4de88de88bdbedb1e0e3", "2", "620824009091", "916200002258722645", "山寨煤矿", "华亭煤业公司","华亭煤业","0"),
    XINYAO("1154264fa6754b9f9ef5cb99a43011fa", "2", "620823009692", "916200002258722645", "新窑公司", "华亭煤业公司","华亭煤业","0"),
    XINBO("4d7e7393a98649fd937add3dfd1cad9a", "2", "620823009365", "916200002258722645", "新柏公司", "华亭煤业公司","华亭煤业","0"),
    DALIU("1796945d37314633be8d7decb8973f3f", "2", "620823009724", "916200002258722645", "大柳煤矿", "华亭煤业公司","华亭煤业","0"),
    CHICHENG("9180a243d847438f8977503a9b6d13f3", "2", "620823009721", "916200002258722645", "赤城煤矿", "华亭煤业公司","华亭煤业","0"),
    LINGQUAN("21a3e97e5ce74d15b4b70e1812da47f7", "2", "150781013603", "91150781720169744B", "灵泉矿", "扎赉诺尔煤业公司","扎煤公司","0"),
    TIEBEI("e6bb50e643914ca29efff8e5a33cec35", "2", "150781013194", "91150781720169744B", "铁北矿", "扎赉诺尔煤业公司","扎煤公司","0"),
    LINGDONG("f8435fa7b0d445b9af1aaf20f3068e6d", "2", "150781013670", "91150781720169744B", "灵东矿", "扎赉诺尔煤业公司","扎煤公司","0"),
    LINGLU("1e24ec060d2a420a8fb3336f7229e612", "2", "150781013671", "91150781720169744B", "灵露矿", "扎赉诺尔煤业公司","扎煤公司","0"),
    BAILONGSHAN("5530e05a561f413099bccd207e27959f", "2", "530325010583", "91530325346622296C", "白龙山煤矿一井", "滇东矿业分公司","滇东公司","0"),
    YONGWANG("404fc7f9dd734de9bd2d7a35b8db02ce", "2", "530325010577", "91530325346622296C", "雨汪煤矿一井", "滇东矿业分公司","滇东公司","0"),
    XINZHUANG("203768db8dc14f53b19b81b5605289be", "2", "621026009696", "91621000566400003E", "新庄煤矿", "庆阳煤电公司","庆阳煤电","0"),
    HETAOYU("034bc0f5cdb140488d3eab2e0231756a", "2", "621025009717", "91621000566400003E", "核桃峪煤矿", "庆阳煤电公司","庆阳煤电","0"),
    LIUYUANZI("3ca6a73bcdce4b9f88d93cabd57b1cf3", "2", "621022009406", "91621000566400003E", "刘园子煤矿", "庆阳煤电公司","庆阳煤电","0"),
    YIMIN("f1bc46722230470e8d98407ed08c7e1a", "1", "150724019283", "911507001151964613", "伊敏露天矿", "伊敏煤电","蒙东公司","2"),
    // 临时解决华亭数据问题
    HUATINGGC("9b81fbb384e646fea44dbb622ac772b2", "1", " ", "916200002258722645", " ", "华亭煤业公司","华亭煤业","0");
    CoalInfo(String id, String type, String mineCode, String companyCode, String mineName, String companyName,String referred,String companyType) {
        this.id = id;
        this.type = type;
        this.mineCode = mineCode;
        this.companyCode = companyCode;
        this.mineName = mineName;
        this.companyName = companyName;
        this.referred = referred;
        this.companyType = companyType;
    }

    public static String[] getCompanyCodesByCompanyType(String companyType) {
        String str = "";
        CoalInfo[] values = values();
        for (CoalInfo value : values) {
            if (value.getCompanyType().equals(companyType)) {
                if (!str.contains(value.getCompanyCode())) {
                    str += value.getCompanyCode() + ",";
                }
            }
        }

        return str.split(",");
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public static String getCompanyNameByCompanyCode(String companyCode) {
        CoalInfo[] values = values();
        for (CoalInfo value : values) {
            if (StrUtil.equalsIgnoreCase(value.getCompanyCode(), companyCode)) return value.getCompanyName();
        }
        return null;
    }

    public static String getCompanyReferredByCompanyCode(String companyCode) {
        CoalInfo[] values = values();
        for (CoalInfo value : values) {
            if (StrUtil.equalsIgnoreCase(value.getCompanyCode(), companyCode)) return value.getReferred();
        }
        return null;
    }
    public static String getCompanyCodeByCompanyName(String companyName) {
        CoalInfo[] values = values();
        for (CoalInfo value : values) {
            if (StrUtil.equalsIgnoreCase(value.getCompanyName(), companyName)) return value.getCompanyCode();
        }
        return null;
    }

    public static Set<String> getCompanyCodes() {
        Set<String> companyCodeSet = new HashSet<>();
        for (CoalInfo coalInfo : CoalInfo.values()) {
            companyCodeSet.add(coalInfo.companyCode);
        }
        return companyCodeSet;
    }

    public static Set<String> getAllMineName() {
        Set<String> companyCodeSet = new HashSet<>();
        for (CoalInfo coalInfo : CoalInfo.values()) {
            companyCodeSet.add(coalInfo.mineName);
        }
        return companyCodeSet;
    }

    public static Map<String, String> getAllGroup() {
        Map<String, String> map = new HashMap<>();

        CoalInfo[] values = values();
        for (CoalInfo value : values) {
            if(!map.containsKey(value.getCompanyName())){
                map.put(value.getCompanyCode(),value.getCompanyName());
            }
        }
        return map;
    }
    public static String [] getMineCodesByCompanyCode(String companyCode) {
        String str = "";
        CoalInfo[] values = values();
        for (CoalInfo value : values) {
            if(value.getCompanyCode().equals(companyCode)){
                str+=value.getMineCode()+",";
            }
        }
        String[] strs = str.split(",");
        return strs;
    }

    public static String getMineNameByMineCode(String mineCode) {
        CoalInfo[] values = values();
        for (CoalInfo value : values) {
            if (StrUtil.equalsIgnoreCase(value.getMineCode(), mineCode)) return value.getMineName();
        }
        return null;
    }

    public static String getCompanyNameByMineCode(String mineCode) {
        CoalInfo[] values = values();
        for (CoalInfo value : values) {
            if (StrUtil.equalsIgnoreCase(value.getMineCode(), mineCode)) return value.getCompanyName();
        }
        return null;
    }

    public static String getCompanyCodeByMineCode(String mineCode) {
        CoalInfo[] values = values();
        for (CoalInfo value : values) {
            if (StrUtil.equalsIgnoreCase(value.getMineCode(), mineCode)) return value.getCompanyCode();
        }
        return null;
    }
    public static String getMineNameByCompanyCode(String mineCode) {
        CoalInfo[] values = values();
        for (CoalInfo value : values) {
            if (StrUtil.equalsIgnoreCase(value.getMineCode(), mineCode)) return value.getMineName();
        }
        return null;
    }

    public static String getTypeByMineName(String mineName) {
        CoalInfo[] values = values();
        for (CoalInfo value : values) {
            if (StrUtil.equalsIgnoreCase(value.getMineName(), mineName)) return value.getType();
        }
        return null;
    }

    public static String getMineCodeById(String id) {
        CoalInfo[] values = values();
        for (CoalInfo value : values) {
            if (StrUtil.equalsIgnoreCase(value.getId(), id)) return value.getMineCode();
        }
        return null;
    }

    public static String getMineNameById(String id) {
        CoalInfo[] values = values();
        for (CoalInfo value : values) {
            if (StrUtil.equalsIgnoreCase(value.getId(), id)) return value.getMineName();
        }
        return null;
    }

    public static String getCompanyNameById(String id) {
        CoalInfo[] values = values();
        for (CoalInfo value : values) {
            if (StrUtil.equalsIgnoreCase(value.getId(), id)) return value.getCompanyName();
        }
        return null;
    }

    public static String getCompanyCodeById(String id) {
        CoalInfo[] values = values();
        for (CoalInfo value : values) {
            if (StrUtil.equalsIgnoreCase(value.getId(), id)) return value.getCompanyCode();
        }
        return null;
    }

    public static String getCompanyCodeByMineName(String mineName) {
        CoalInfo[] values = values();
        for (CoalInfo value : values) {
            if (StrUtil.equalsIgnoreCase(value.getMineName(), mineName)) return value.getCompanyCode();
        }
        return null;
    }

    public static String getCompanyNameByMineName(String mineName) {
        CoalInfo[] values = values();
        for (CoalInfo value : values) {
            if (StrUtil.equalsIgnoreCase(value.getMineName(), mineName)) return value.getCompanyName();
        }
        return null;
    }

    public static String getMineCodeByMineName(String mineName) {
        CoalInfo[] values = values();
        for (CoalInfo value : values) {
            if (StrUtil.equalsIgnoreCase(value.getMineName(), mineName)) return value.getMineCode();
        }
        return null;
    }




    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getMineCode() {
        return mineCode;
    }

    public void setMineCode(String mineCode) {
        this.mineCode = mineCode;
    }

    public String getCompanyCode() {
        return companyCode;
    }

    public void setCompanyCode(String companyCode) {
        this.companyCode = companyCode;
    }

    public String getMineName() {
        return mineName;
    }

    public void setMineName(String mineName) {
        this.mineName = mineName;
    }

    public String getCompanyName() {
        return companyName;
    }

    public void setCompanyName(String companyName) {
        this.companyName = companyName;
    }


    public String getReferred() {
        return referred;
    }

    public void setReferred(String referred) {
        this.referred = referred;
    }

    public String getCompanyType() {
        return companyType;
    }

    public void setCompanyType(String companyType) {
        this.companyType = companyType;
    }

    private String id;
    private String type;
    private String mineCode;
    private String companyCode;
    private String mineName;
    private String companyName;
    private String referred;
    private String companyType;//0煤业1北方2蒙东


}
